<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
use Spatie\Permission\Models\Role;
use Spatie\Permission\Traits\HasRoles;

class Admin extends Authenticatable
{
    use HasFactory, Notifiable, HasApiTokens, HasRoles;

    protected $fillable = ['name', 'mobile', 'password', 'avatar'];
    protected $hidden = [
        'password'
    ];
    public $guard_name = 'sanctum';

    public function roles()
    {
        return $this->morphToMany(Role::class, 'model', 'model_has_roles');
    }
}
